<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<base href="<%=basePath%>">
<!-- start: CSS -->
<link id="bootstrap-style" href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap-responsive.min.css" rel="stylesheet">
<link id="base-style" href="css/style.css" rel="stylesheet">
<link id="base-style-responsive" href="css/style-responsive.css"
	rel="stylesheet">
<!-- end: CSS -->
<title>上传</title>

</head>
<body>
	<!-- start: Header -->
	<jsp:include page="header.jsp"></jsp:include>
	<!-- start: Header -->

	<div class="container-fluid-full">
		<div class="row-fluid">

			<jsp:include page="sidebar.jsp"></jsp:include>

			<!-- start: Content -->
			<!-- start: 主体 -->
			<div id="content" class="span10">
				<ul class="breadcrumb">
					<li><i class="icon-home"></i> <a href="index.jsp">Home</a> <i
						class="icon-angle-right"></i></li>
					<li>上传</li>
				</ul>


				<div class="row-fluid hideInIE8 circleStats">
					<!--start写在这里-->
					<div class="box-content">

						<form id="file_form" action="upload" enctype="multipart/form-data"
							method="post">
							<input class="input-file uniform_on" type="file" name="file"
								id="file_input" /> <input class="btn btn-primary" type="submit"
								value="文件上传" id='upFile-btn'>
						</form>
					</div>
					<!--/row-->
				</div>


			</div>

			<!-- end: Content -->
			<!-- end: 主体结束 -->
		</div>
		<!--/#content.span10-->
	</div>
	<!--/fluid-row-->
	<jsp:include page="footer.jsp"></jsp:include>

	<!-- start: JavaScript-->

	<script src="js/jquery-1.9.1.min.js"></script>
	<script src="js/jquery-migrate-1.0.0.min.js"></script>

	<script src="js/jquery-ui-1.10.0.custom.min.js"></script>

	<script src="js/jquery.ui.touch-punch.js"></script>

	<script src="js/modernizr.js"></script>

	<script src="js/bootstrap.min.js"></script>

	<script src="js/jquery.cookie.js"></script>

	<script src='js/fullcalendar.min.js'></script>

	<script src='js/jquery.dataTables.min.js'></script>

	<script src="js/excanvas.js"></script>
	<script src="js/jquery.flot.js"></script>
	<script src="js/jquery.flot.pie.js"></script>
	<script src="js/jquery.flot.stack.js"></script>
	<script src="js/jquery.flot.resize.min.js"></script>

	<script src="js/jquery.chosen.min.js"></script>

	<script src="js/jquery.uniform.min.js"></script>

	<script src="js/jquery.cleditor.min.js"></script>

	<script src="js/jquery.noty.js"></script>

	<script src="js/jquery.elfinder.min.js"></script>

	<script src="js/jquery.raty.min.js"></script>

	<script src="js/jquery.iphone.toggle.js"></script>

	<script src="js/jquery.uploadify-3.1.min.js"></script>

	<script src="js/jquery.gritter.min.js"></script>

	<script src="js/jquery.imagesloaded.js"></script>

	<script src="js/jquery.masonry.min.js"></script>

	<script src="js/jquery.knob.modified.js"></script>

	<script src="js/jquery.sparkline.min.js"></script>

	<script src="js/counter.js"></script>

	<script src="js/retina.js"></script>

	<script src="js/custom.js"></script>
	<script src="js/echarts.min.js"></script>
	<!-- end: JavaScript-->
	
	<script type="text/javascript">
	$(function() {
		$("#file_form").submit(
				function() {
					//首先验证文件格式
					var fileName = $('#file_input').val();
					if (fileName === '') {
						alert('请选择文件');
						return false;
					}
					var fileType = (fileName.substring(fileName
							.lastIndexOf(".") + 1, fileName.length))
							.toLowerCase();
					if (fileType !== 'xls' && fileType !== 'xlsx') {
						alert('文件格式不正确，excel文件！');
						return false;
					}

					$("#file_form").ajaxSubmit({
						dataType : "json",
						success : function(data, textStatus) {
							if (data.result = "ok") {
								console.log(data.info);
							} else {
								console.log('文件格式错误');
							}
							return false;
						}
					});
					return false;
				});
	});
</script>
	
	
</body>
</html>